﻿@model FanPages.Model.FanItem

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm("Edit", "FanItem", FormMethod.Post, new { enctype="multipart/form-data" }))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>FanItem</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Code)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Code)
            @Html.ValidationMessageFor(model => model.Code)
        </div>
        <div class="editor-label">
            <label for="Image">Image</label>
        </div>
        <div class="editor-field">
            <input type="file" name="image" id="FileUpload" />
        </div>   
        @if (Model.Image != null) 
        { 
        <div class="editor-field">
            <img alt="Fan Item Image" src='@Url.Action("GetImage", new { id = @Model.Id })'   />
        </div>        }
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
